package com.lotus.minio.exception;

import java.util.Map;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {
	
	/**
     * 捕获所有异常并返回统一的错误响应
     * @param e 捕获的异常
     * @return 错误的 ResponseEntity
     */
	@ExceptionHandler(Exception.class)
    public ResponseEntity<?> handleException(Exception e) {
        return ResponseEntity.status(500).body(Map.of("success", false, "message", e.getMessage()));
    }
}
